<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JS实现风景相册的大小图</title>
  <style>
    * {margin: 0; padding: 0;}
    ul {
      list-style: none;
    }
    ul li {
      float: left;
      margin-right: 35px;
    }
  </style>
</head>
<body>
  <img src="img/1.jpg">
  <ul>
    <li>
      <a href="img/1.jpg"><img src="img/1.jpg" width="150px"></a>
    </li>
    <li>
      <a href="img/2.jpg"><img src="img/2.jpg" width="150px"></a>
    </li>
    <li>
      <a href="img/3.jpg"><img src="img/3.jpg" width="150px"></a>
    </li>
  </ul>

  <script>
    var img = document.getElementsByTagName('img')[0];
    var aList = document.getElementsByTagName('a');
    for(let i=0; i<aList.length; i++) {
      aList[i].onmouseover = function(){
      	img.style.display = 'none';
        img.setAttribute('src', this.href);
        img.style.display = 'block';
      }
    }
  </script>
</body>
</html>